package org.dromara.job.dnnyun.processors;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.dromara.data.dnnyun.service.IDnnyunDataService;
import org.springframework.stereotype.Component;
import tech.powerjob.worker.core.processor.ProcessResult;
import tech.powerjob.worker.core.processor.TaskContext;
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
import tech.powerjob.worker.log.OmsLogger;


/**
 * 同步门店列表
 *
 * @author wdm
 * @since 2024/3/18
 */
@Slf4j
@Component
public class StoreListProcessor implements BasicProcessor {
    @Resource
    private IDnnyunDataService dnnyunDataService;

    @Override
    public ProcessResult process(TaskContext context) throws Exception {
        OmsLogger omsLogger = context.getOmsLogger();
        omsLogger.info("dnnyun storeListProcessor,context is {}.", context);
        dnnyunDataService.syncStore();
        boolean success = true;
        omsLogger.info("dnnyun storeListProcessor finished process,success: {}", success);
        return new ProcessResult(success, context + ": " + success);
    }
}
